<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview
<span class='line'>  3</span>  * mixing.enchant.js
<span class='line'>  4</span>  * &lt;p>Ein Plugin für enchant.js mit dem es möglich ist, beliebig viele
<span class='line'>  5</span>  * {@link enchant.Class} Klassen zusammen zu mischen.
<span class='line'>  6</span>  * Um Copy & Paste zu vermeiden, ist es auch möglich Funktionen und
<span class='line'>  7</span>  * Properties, die in einem Rezept ({@link enchant.Class.MixingRecipe}) 
<span class='line'>  8</span>  * definiert sind zu beliebig vielen Klassen hinzuzufügen.&lt;/p>
<span class='line'>  9</span>  * &lt;p>Durch dies ist es möglich ein Verhalten ähnlich zu multipler Vererbung zu erlangen.&lt;/p>
<span class='line'> 10</span>  * &lt;p>Benötigt:&lt;ul>
<span class='line'> 11</span>  * &lt;li>enchant.js v0.6 oder höher.&lt;/li>&lt;/ul>&lt;/p>
<span class='line'> 12</span>  * Weiterführende Informationen: {@link enchant.Class.mixClasses}, {@link enchant.Class.MixingRecipe.createFromClass}, 
<span class='line'> 13</span>  * {@link enchant.Class.mixClassesFromRecipe}, {@link enchant.Class.MixingRecipe} und 
<span class='line'> 14</span>  * {@link enchant.Class.applyMixingRecipe}
<span class='line'> 15</span>  * @require enchant.js v0.6+
<span class='line'> 16</span>  *
<span class='line'> 17</span>  * @version 0.1
<span class='line'> 18</span>  * @author UEI Corporation (Kevin Kratzer)
<span class='line'> 19</span>  **/</span><span class="WHIT">
<span class='line'> 20</span> 
<span class='line'> 21</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">enchant</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">    </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 23</span> 
<span class='line'> 24</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 25</span>          * @private
<span class='line'> 26</span>          */</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">decorateFunctionFactory</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">srcFunction</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">currentFunctionName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">                </span><span class="NAME">firstResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">currentFunctionName</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">                </span><span class="NAME">secondResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">srcFunction.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">secondResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">firstResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 40</span> 
<span class='line'> 41</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 42</span>          * @private
<span class='line'> 43</span>          */</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> 
<span class='line'> 46</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 47</span>          * @private
<span class='line'> 48</span>          */</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">multipleMixingCombinationFunctionFactory</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oldFunc</span><span class="PUNC">,</span><span class="NAME">newFunc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oldFunc.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mixingStore</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">                </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newFunc.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">                </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mixingStore</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">secondResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">firstResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> 
<span class='line'> 65</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 66</span>          * @private
<span class='line'> 67</span>          */</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">createFromPrototypeNonRecursive</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">override</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">descriptor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.getOwnPropertyDescriptor</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">descriptor.value</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">descriptor.value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">functionIgnoreNameList</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList.indexOf</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'constructor'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">functionOverrideNameList</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList.indexOf</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">                                </span><span class="NAME">decorate</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">decorateFunctionFactory</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">                                </span><span class="NAME">override</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">propertyIgnoreNameList</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList.indexOf</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'_mixing'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">                            </span><span class="NAME">properties</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">descriptor</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> 
<span class='line'> 89</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 90</span>          * @private
<span class='line'> 91</span>          */</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">createFromPrototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">,</span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">onlyOwnProperties</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">                </span><span class="NAME">createFromPrototype</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">Object.getPrototypeOf</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">            </span><span class="NAME">createFromPrototypeNonRecursive</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 98</span> 
<span class='line'> 99</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>100</span>          * @private
<span class='line'>101</span>          */</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">getFunctionParams</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">methodString</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">methodString</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">                </span><span class="NAME">methodString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">methodString.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">methodString.substring</span><span class="PUNC">(</span><span class="NAME">methodString.indexOf</span><span class="PUNC">(</span><span class="STRN">'('</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">methodString.indexOf</span><span class="PUNC">(</span><span class="STRN">')'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/\s+/</span><span class="PUNC">,</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> 
<span class='line'>109</span> </span><span class="WHIT">        </span><span class="COMM">/*Public Interface */</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>111</span>          * @scope enchant.Class.MixingRecipe.prototype
<span class='line'>112</span>          */</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.MixingRecipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">enchant.Class.create</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>115</span>              * Erstellt ein neues MixingRecipe, welches beschreibt, auf welche Art und Weise Funktionen und Properties während des Mischens hinzugefügt werden.
<span class='line'>116</span>              * Um ein Rezept aus einer bereits existierend Klasse zu erstellen, ist auf {@link enchant.Class.MixingRecipe.createFromClass} zu verweisen.
<span class='line'>117</span>              * @class Diese Klasse beschreibt auf welche Art und Weise das mischen mit der Zielklasse durchgeführt wird.
<span class='line'>118</span>              * Für diesen Zweck enthählt ein MixingRecipe drei Properties:
<span class='line'>119</span>              * &lt;ul>&lt;li>decorateMethods (Methoden, welche in der Zielklasse dekoriert werden, siehe Dekorierer Entwurfsmuster)&lt;/li>
<span class='line'>120</span>              * &lt;li>overrideMethods (Methoden, welche in der Zielklasse überschrieben werden)&lt;/li>
<span class='line'>121</span>              * &lt;li>overrideProperties (Properties, welche in der Zielklasse redefiniert werden)&lt;/li>&lt;/ul>
<span class='line'>122</span>              * &lt;p>Siehe auch: {@link enchant.Class.mixClasses}, {@link enchant.Class.mixClassesFromRecipe} und {@link enchant.Class.applyMixingRecipe}.&lt;/p>
<span class='line'>123</span>              * @param {Object} decorateMethods Die Methoden, welche in der Zielklasse dekoriert werden, siehe Dekorierer Entwurfsmuster. Auf die dekoriertie Methode kann in der durch das Mixen erstellten Klasse mit Hilfe des _mixing Property zugegriffen werden, z.B. this._mixing.myFunction.apply(this,arguments).&lt;br>(Objekt welches Schlüssel-Wert Paare enthält, Schlüssel := Funktionsname, Wert := Funktion)
<span class='line'>124</span>              * @param {Object} overrideMethods Die Methoden, welche in der Zielklasse überschrieben werden.&lt;br>(Objekt welches Schlüssel-Wert Paare enthält, Schlüssel := Funktionsname, Wert := Funktion).
<span class='line'>125</span>              * @param {Object} properties Die Properties, welche in der Zielklasse redefiniert werden.&lt;br>(Objekt welches Schlüssel-Wert Paare enthält, Schlüssel := Funktionsname, Wert := Propertydescriptor).
<span class='line'>126</span>              * @property {Object} decorateMethods Die Methoden, welche in der Zielklasse dekoriert werden, siehe Dekorierer Entwurfsmuster. Auf die dekoriertie Methode kann in der durch das Mixen erstellten Klasse mit Hilfe des _mixing Property zugegriffen werden, z.B. this._mixing.myFunction.apply(this,arguments).&lt;br>(Objekt welches Schlüssel-Wert Paare enthält, Schlüssel := Funktionsname, Wert := Funktion)
<span class='line'>127</span>              * @property {Object} overrideMethods Die Methoden, welche in der Zielklasse überschrieben werden.&lt;br>(Objekt welches Schlüssel-Wert Paare enthält, Schlüssel := Funktionsname, Wert := Funktion).
<span class='line'>128</span>              * @property {Object} overrideProperties Die Properties, welche in der Zielklasse redefiniert werden.&lt;br>(Objekt welches Schlüssel-Wert Paare enthält, Schlüssel := Funktionsname, Wert := Propertydescriptor).
<span class='line'>129</span>              * @example
<span class='line'>130</span>              *      var recipe = new enchant.Class.MixingRecipe({
<span class='line'>131</span>              *          add : function(value) {
<span class='line'>132</span>              *              this._myValue += 3*value;
<span class='line'>133</span>              *              this._mixing.add.apply(this,arguments);
<span class='line'>134</span>              *          },
<span class='line'>135</span>              *          mult : function(value) {
<span class='line'>136</span>              *              this._myValue *= value*7;
<span class='line'>137</span>              *              this._mixing.mult.apply(this,arguments);
<span class='line'>138</span>              *          }
<span class='line'>139</span>              *      },{
<span class='line'>140</span>              *          sub : function(value) {
<span class='line'>141</span>              *              this._myValue -= 5*value;
<span class='line'>142</span>              *          }
<span class='line'>143</span>              *      },{
<span class='line'>144</span>              *      myProperty : {
<span class='line'>145</span>              *          get: function() {
<span class='line'>146</span>              *              return 3*this._myPropertyValue;
<span class='line'>147</span>              *          },
<span class='line'>148</span>              *          set : function(val) {
<span class='line'>149</span>              *              this._myPropertyValue = val;
<span class='line'>150</span>              *          }
<span class='line'>151</span>              *      }});
<span class='line'>152</span>              *      var NewClass = enchant.Class.applyMixingRecipe(Class1,recipe);
<span class='line'>153</span>              * @extends Object
<span class='line'>154</span>              * @constructs
<span class='line'>155</span>              */</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">            </span><span class="NAME">initialize</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">decorateMethods</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">overrideMethods</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">                </span><span class="NAME">this.decorateMethods</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">decorateMethods</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">                </span><span class="NAME">this.overrideMethods</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">overrideMethods</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">                </span><span class="NAME">this.overrideProperties</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>162</span> 
<span class='line'>163</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>164</span>          * Nimmt die Methoden und Properties der übergebenen Klasse um ein neues MixingRecipe zu erstellen.
<span class='line'>165</span>          * Das Standardverhalten dabei ist, alle Funktionen und Properties der übergebenen Klasse, 
<span class='line'>166</span>          * einschließlich der Funktionen und Properties in den Superklassen zu nehmen und diese
<span class='line'>167</span>          * in der Zielklasse beim mixen zu dekorieren.&lt;br>Methoden welche dekoriert werden, rufen
<span class='line'>168</span>          * automatisch die Methoden der sourceClass und der Zielklasse des Mixens, mit Hilfe des
<span class='line'>169</span>          * _mixing Properties, auf. Daher muss dies nicht selbst berücksichtigt werden.
<span class='line'>170</span>          * &lt;p>Durch die entsprechenden Argumente der Funktion kann das Standardverhalten zu verändert werden.&lt;/p>
<span class='line'>171</span>          * 
<span class='line'>172</span>          * @param {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} sourceClass Die Klasse aus der das MixingRecipe erstellt wird.
<span class='line'>173</span>          * @param [boolean] onlyOwnProperties Wenn dieses Argument true ist, werden Funktionen und Properties der Superklassen ignoriert. 
<span class='line'>174</span>          * @param [Array&lt;String>] functionOverrideNameList Ein Array welches Namen von Funktionen enthält, welche während des Mixens überschrieben werden sollen. 
<span class='line'>175</span>          * @param [Array&lt;String>] functionIgnoreNameList Ein Array welches Namen von Funktionen enthält, welche bei der MixingRecipe erstellung ignoriert werden sollen. 
<span class='line'>176</span>          * @param [Array&lt;String>] propertyIgnoreNameList Ein Array welches Namen von Properties enthält, welche bei der MixingRecipe erstellung ignoriert werden sollen.
<span class='line'>177</span>          * @returns {enchant.Class.MixingRecipe} Das MixingRecipe, welches aus der Definition der sourceClass erstellt wurde.
<span class='line'>178</span>          * @example
<span class='line'>179</span>          *      var recipe = enchant.Class.MixingRecipe.createFromClass(Class2, true, 
<span class='line'>180</span>          *              ['overrideFunction1','overrideFunction2'],
<span class='line'>181</span>          *              ['ignoreFunction1','ignoreFunction2'],
<span class='line'>182</span>          *              ['ignoreProperty1','ignorePropterty2']);
<span class='line'>183</span>          *      recipe.overrideMethods['additionalFunction'] = new function() {
<span class='line'>184</span>          *          console.log('Hello, World');
<span class='line'>185</span>          *      }
<span class='line'>186</span>          *      recipe.overrideProperties['newProperty'] = {
<span class='line'>187</span>          *          get: function() {
<span class='line'>188</span>          *              return this._newProperty;
<span class='line'>189</span>          *          },
<span class='line'>190</span>          *          set : function(val) {
<span class='line'>191</span>          *              this._newProperty = val;
<span class='line'>192</span>          *          }
<span class='line'>193</span>          *      }
<span class='line'>194</span>          *      var NewClass = enchant.Class.mixClassesFromRecipe(Class1,Class2,recipe);
<span class='line'>195</span>          * @constructs
<span class='line'>196</span>          * @static
<span class='line'>197</span>          */</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.MixingRecipe.createFromClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sourceClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">decorate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">override</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>202</span> 
<span class='line'>203</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sourceClass.prototype</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">            </span><span class="NAME">createFromPrototype</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">,</span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">enchant.Class.MixingRecipe</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>207</span> 
<span class='line'>208</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>209</span>          * Nutzt das gegebene MixingRecipe, wendet es auf die "firstClass" Klasse an und liefert das Ergebnis daraus zurück - das MixingRecipe sollte der secondClass entsprechen.
<span class='line'>210</span>          * Eine Standard-Initialisierungsmethode wird hinzugefügt, welche die Initialisierungsmethode beider Klassen aufruft.
<span class='line'>211</span>          * Die Signatur für diese Standard-Initialisierungsmethode ist:&lt;br>
<span class='line'>212</span>          * ([firstClass Konstruktor Arg 1],...,[firstClass Konstruktor Arg n],[secondClass Konstruktor Arg 1],...[secondClass Konstruktor Arg n])&lt;/p>
<span class='line'>213</span>          * &lt;p>Beide Klassen werden nicht verändert.&lt;/p> Siehe auch: {@link enchant.Class.MixingRecipe}
<span class='line'>214</span>          * @param {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} firstClass Die Klasse auf die das MixingRecipe angewendet wird.
<span class='line'>215</span>          * @param {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} secondClass Die Klasse die dem MixingRecipe entpsricht, wird für die Standard-Initialisierungsmethode genutzt.
<span class='line'>216</span>          * @param {enchant.Class.MixingRecipe} recipe Das MixingRecipe, welches auf die firstClass Klasse angewendet wird - sollte der secondClass entsprechen.
<span class='line'>217</span>          * @param [Function] initializeMethod Falls gegeben, wird diese Methode, anstelle der Standard-Initialisierungsmethode, zum Initialisieren der resultierenden Klasse verwendet. 
<span class='line'>218</span>          * @returns {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} Die Klasse, welche das Ergebnis des Mixens beider Klassen mit Hilfe des MixingRecipe darstellt.
<span class='line'>219</span>          * @example
<span class='line'>220</span>          *      var MapGroup = enchant.Class.mixClasses(Map, Group,true);
<span class='line'>221</span>          *      var map = new MapGroup(16, 16);
<span class='line'>222</span>          *      var SpriteLabel = enchant.Class.mixClasses(Sprite, Label,true);
<span class='line'>223</span>          *      var kumaLabel = new SpriteLabel(32,32,'Kuma');
<span class='line'>224</span>          * @static
<span class='line'>225</span>          */</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.mixClassesFromRecipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">recipe</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">enchant.Class.applyMixingRecipe</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="NAME">recipe</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">paramLength</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">getFunctionParams</span><span class="PUNC">(</span><span class="NAME">firstClass.prototype.initialize</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT">                </span><span class="NAME">initializeMethod</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">                    </span><span class="NAME">secondClass.prototype.initialize.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">args.slice</span><span class="PUNC">(</span><span class="NAME">paramLength</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT">                    </span><span class="NAME">firstClass.prototype.initialize.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">args.slice</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">paramLength</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT">            </span><span class="NAME">result.prototype.initialize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initializeMethod</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> 
<span class='line'>240</span> 
<span class='line'>241</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>242</span>          * Erstellt ein MixingRecipe aus der "secondClass" Klasse, wendet dieses auf die "firstClass" Klasse an und liefert das Ergebnis daraus zurück.
<span class='line'>243</span>          * Das Standardverhalten dabei ist, alle Funktionen und Properties der "secondClass" Klasse, 
<span class='line'>244</span>          * einschließlich der Funktionen und Properties in deren Superklassen zu nehmen und diese
<span class='line'>245</span>          * in der Zielklasse beim mixen zu dekorieren.&lt;br>Methoden welche dekoriert werden, rufen
<span class='line'>246</span>          * automatisch die Methoden der sourceClass und der Zielklasse des Mixens, mit Hilfe des
<span class='line'>247</span>          * _mixing Properties, auf. Daher muss dies nicht selbst berücksichtigt werden.
<span class='line'>248</span>          * &lt;p>Des Weiteren wird eine Standard-Initialisierungsmethode, welche die Initialisierungsmethode beider Klassen aufruft, hinzugefügt.
<span class='line'>249</span>          * Die Signatur für diese Standard-Initialisierungsmethode ist:&lt;br>
<span class='line'>250</span>          * ([firstClass Konstruktor Arg 1],...,[firstClass Konstruktor Arg n],[secondClass Konstruktor Arg 1],...[secondClass Konstruktor Arg n])&lt;/p>
<span class='line'>251</span>          * &lt;p>Beide Klassen werden nicht verändert.&lt;/p> Siehe auch: {@link enchant.Class.MixingRecipe}
<span class='line'>252</span>          * 
<span class='line'>253</span>          * @param {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} firstClass Die Klasse auf die das MixingRecipe angewendet wird.
<span class='line'>254</span>          * @param {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} secondClass Die Klasse aus der das MixingRecipe erstellt wird.
<span class='line'>255</span>          * @param [boolean] onlyOwnProperties Wenn dieses Argument true ist, werden Funktionen und Properties der Superklassen der "secondClass" Klasse ignoriert. 
<span class='line'>256</span>          * @param [Function] initializeMethod Falls gegeben, wird diese Methode, anstelle der Standard-Initialisierungsmethode, zum Initialisieren der resultierenden Klasse verwendet. 
<span class='line'>257</span>          * @returns {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} Die Klasse, welche das Ergebnis des Mixens beider Klassen darstellt.
<span class='line'>258</span>          * @example
<span class='line'>259</span>          *      var MapGroup = enchant.Class.mixClasses(Map, Group,true);
<span class='line'>260</span>          *      var map = new MapGroup(16, 16);
<span class='line'>261</span>          *      var SpriteLabel = enchant.Class.mixClasses(Sprite, Label,true);
<span class='line'>262</span>          *      var kumaLabel = new SpriteLabel(32,32,'Kuma');
<span class='line'>263</span>          * @static
<span class='line'>264</span>          */</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.mixClasses</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">useOnlyOwnPropertiesForSecondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">enchant.Class.mixClassesFromRecipe</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="NAME">enchant.Class.MixingRecipe.createFromClass</span><span class="PUNC">(</span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">useOnlyOwnPropertiesForSecondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'initialize'</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>268</span> 
<span class='line'>269</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>270</span>          * Wendet das übergebene MixingRecipe auf die Zielklasse an, erstellt eine neue Klassendefinition und liefert diese als Rückgabewert zurück.
<span class='line'>271</span>          * Die Zielklasse wird nicht modifiziert.&lt;br>Siehe auch: {@link enchant.Class.MixingRecipe}.
<span class='line'>272</span>          * 
<span class='line'>273</span>          * @param {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} target Die Klasse auf die das MixingRecipe angewendet wird.
<span class='line'>274</span>          * @param {enchant.Class.MixingRecipe} source Das MixingRecipe, welches genutzt wird um der Zielklasse neue Funktionalität zu verleihen. 
<span class='line'>275</span>          * @returns {Function&lt;constructor Funktion die mit enchant.Class erstellt wurde>} Die Klasse, welche das Ergebnis des Mixens der Zielklasse (target) mit dem Rezept (source) darstellt. 
<span class='line'>276</span>          * @example
<span class='line'>277</span>          *      var recipe = new enchant.Class.MixingRecipe({
<span class='line'>278</span>          *         // ... see enchant.Class.MixingRecipe
<span class='line'>279</span>          *      },{
<span class='line'>280</span>          *          // ... see enchant.Class.MixingRecipe
<span class='line'>281</span>          *      },{
<span class='line'>282</span>          *          // ... see enchant.Class.MixingRecipe
<span class='line'>283</span>          *      });
<span class='line'>284</span>          *      var NewClass = applyMixingRecipe(Class1,recipe);
<span class='line'>285</span>          * @static
<span class='line'>286</span>          */</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.applyMixingRecipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">enchant.Class.create</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT">            </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.prototype</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">recipeKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'overrideMethods'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">methodKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentSource.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">methodKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">                                </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">                                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target._mixing</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">                                    </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'overrideProperties'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">propertyKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentSource.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">propertyKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT">                                </span><span class="NAME">Object.defineProperty</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="NAME">propertyKey</span><span class="PUNC">,</span><span class="NAME">currentSource</span><span class="PUNC">[</span><span class="NAME">propertyKey</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'decorateMethods'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target._mixing</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">                            </span><span class="NAME">target._mixing</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>312</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>313</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentSource.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT">                                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">targetHolder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">                                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">                                    </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">targetHolder</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">targetHolder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">                                        </span><span class="NAME">targetHolder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.getPrototypeOf</span><span class="PUNC">(</span><span class="NAME">targetHolder</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">                                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT">                                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT">                                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">newFunc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">targetHolder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT">                                    </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">multipleMixingCombinationFunctionFactory</span><span class="PUNC">(</span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">newFunc</span><span class="PUNC">,</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT">                                    </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">targetHolder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT">                                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">                                        </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">                                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">                                </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>338</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>339</span> </span></pre></body></html>